package com.xudow.app.util;

/**
 * String utilities
 *
 * @author lukecheng
 */
public class StringUtils {

    //public static final String REGEX_MOBILE = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
    public static final String REGEX_MOBILE = "^((13[0-9])|(15[0-9])|(18[0-9]))\\d{8}$";

    public static boolean isEmpty(String value) {
        return ("".equals(value)) || (null == value) || ("null".equals(value));
    }

    /**
     * 校验手机号
     */
    public static boolean isMobile(String mobile) {
        return mobile.length() == 11;
        //return Pattern.matches(REGEX_MOBILE, mobile);
    }

    public static int toInt(String value, int defValue) {
        int ret = defValue;

        if (!android.text.TextUtils.isEmpty(value)) {
            ret = Integer.parseInt(value);
        }

        return ret;
    }
}
